package com.jf.springboot;

import com.jf.springboot.bean.Cat;
import com.jf.springboot.bean.Dog;
import com.jf.springboot.bean.Person;
import com.jf.springboot.bean.Student;
import com.jf.springboot.config.BeanConfig2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-11-25
 * Time:20:07
 */
@SpringBootApplication(scanBasePackages = {"com.jf"})
public class MainApp {
    public static void main(String[] args) {
        ApplicationContext ioc = SpringApplication.run(MainApp.class, args);

        //Student student = ioc.getBean(Student.class);
        //Student student1 = ioc.getBean("student01", Student.class);
        //System.out.println("student: " + student + " ---- " + student.hashCode());
        //System.out.println("student1: " + student + " ---- " + student1.hashCode());
        //System.out.println(student == student1);

        //BeanConfig2 beanConfig2 = ioc.getBean("beanConfig2", BeanConfig2.class);
        //Student student = beanConfig2.student02();
        //Student student1 = beanConfig2.student02();
        //System.out.println("student: " + student + " ---- " + student.hashCode());
        //System.out.println("student1: " + student + " ---- " + student1.hashCode());
        //System.out.println(student == student1);
        //System.out.println("================================================");
        //student = ioc.getBean("student02", Student.class);
        //student1 = ioc.getBean("student02", Student.class);
        //System.out.println("student: " + student + " ---- " + student.hashCode());
        //System.out.println("student1: " + student + " ---- " + student1.hashCode());
        //System.out.println(student == student1);

        //Cat cat = ioc.getBean(Cat.class);
        //Dog dog = ioc.getBean(Dog.class);
        //System.out.println(cat + " ---- " + dog);

        //System.out.println("is student exist: " + ioc.containsBean("student"));

        System.out.println("person: " + ioc.getBean(Person.class));
    }
}
